Skip to content

Retain and reap testbed commands before lifecycle cleanup - #927

Closed
Gajesh2007 wants to merge 2 commits into
masterfrom
refactor/e2e-provider-lifecycle
Closed

Gajesh2007 wants to merge 2 commits into
masterfrom
refactor/e2e-provider-lifecycle

Conversation

@Gajesh2007

@Gajesh2007 Gajesh2007 commented Sep 12, 2026 •

Copy link
Copy Markdown
Member

Local testbed completion could race outstanding provider log output because it waited directly on os.Process, and native Postgres reconstructed a display PID at shutdown without reaping the command it started. A malformed owned-helper event could also leave the helper blocked writing stdout while its controller waited for exit.

The lifecycle now waits through exec.Cmd, retains the native database's actual child handle, and closes a rejected helper stream before waiting. Native startup creates an exclusive temporary directory and cleans it on initialization/readiness failures; stop waits for graceful exit or escalates to kill, then removes owned data only after reaping. An unconfirmed termination retains the data and ownership record. Docker/native setup share the duplicate free-port and readiness loops, retaining their distinct probes and existing cadence.

Before:

flowchart TD
  P[Local provider child] --> PW[Process.Wait]
  PW --> D[Completion may precede log drain]
  N[Native Postgres] --> ID[Display PID string]
  ID --> K[FindProcess and signals without Cmd.Wait]
  K --> RM[Remove data without reaping]
  H[Malformed helper event] --> S[Stop scanning stdout]
  S --> W[Wait while helper can block on full stdout pipe]
  A[Docker and native startup] --> DUP[Separate free-port and readiness loops]
Loading

After:

flowchart TD
  P[Local provider child] --> PW[Cmd.Wait drains output and context cleanup]
  PW --> D[Confirmed command completion]
  N[Native Postgres] --> O[Retained command and done channel]
  O --> K[Interrupt then bounded kill fallback]
  K --> C{Reaped?}
  C -->|yes| RM[Remove only owned temporary data]
  C -->|unconfirmed| KEEP[Retain owned data and command for recovery]
  H[Malformed helper event] --> CL[Close control and rejected stdout pipes]
  CL --> W[Wait without blocking helper output]
  A[Docker and native startup] --> SH[Shared port allocation and readiness loop]
  SH --> PR[Existing backend-specific readiness probe]
Loading

Validation: scoped provider/owned-host/config/KV/Postgres Go suites pass with -race; all native lifecycle fixtures use harmless copies of the Go test binary behind PATH stubs, and all 18 Python owned-host fixtures pass. The new provider output-drain and malformed-stream regressions both fail on master and pass on this source. Additional fixtures cover graceful/forced native child retirement, init/readiness failure cleanup, display-ID independence and cancellation. Formatting, diff checks and docs lint pass.

No Swift, model, GPU, actual database/Docker service, signing operation, production endpoint or SSH session was executed. Existing model/cache/measurement/config/environment policy and the owned-host lease/process-group/receipt protocol are preserved. This PR changes test infrastructure; it supplies no new model-performance or real two-host release evidence.


View with [code]smith Autofix with [code]smith
Need help on this PR? Tag @codesmith-bot with what you need. Autofix is disabled.

@vercel

vercel Bot commented Sep 12, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
d-inference Ready Ready Preview Sep 12, 2026 12:02am UTC
d-inference-console-ui-dev Ready Ready Preview Sep 12, 2026 12:02am UTC
d-inference-landing Ready Ready Preview Sep 12, 2026 12:02am UTC

Request Review

@Gajesh2007

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 12, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-09-12T00:06:35.381370Z c15dfeb Manual request
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. 👍

Reviewed commit: c15dfeb8ac

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@Gajesh2007

Copy link
Copy Markdown
Member Author

Consolidated into #1096, the combined tooling, benchmark and E2E refactor PR. Your latest head c15dfeb8ac0f1484a9102944744fd87934c3088a is preserved in aggregate 9d2160bb370e8a0dbf3810e61a5e48fe66345651, along with the relevant review fixes. Continue review and merge at #1096 (after provider #1094 and web #1095). Closing this duplicate merge path; the source branch and review history are retained.

@Gajesh2007 Gajesh2007 closed this Sep 16, 2026

This branch had an error being deployed

1 failed and 3 active deployments
Preview – d-inference — c15dfeb8 Deployed Sep 12, 2026 by vercel[bot]
Preview – d-inference-console-ui-dev — c15dfeb8 Deployed Sep 12, 2026 by vercel[bot]
benchmarks — c15dfeb8 Deployed Sep 12, 2026 by Gajesh2007 via E2E Benchmarks #999
Preview – d-inference-landing — c15dfeb8 Deployed Sep 12, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant